#include "duck.h"
#include "BlocksMatrix.h"

duck::duck(CBlocksMatrix* pParent) : CTetrad(pParent,vat_convit)
{
}

duck::~duck()
{
}

bool duck::Rotate()
{
	return true;
}

bool duck::MoveLeft()
{
	bool bSuccess = false;
			m_iXPos--;
			bSuccess = true;
	return bSuccess;
}

bool duck::MoveRight()
{
	bool bSuccess = false;
			m_iXPos++;
			bSuccess = true;
	return bSuccess;
}

bool duck::MoveDown()
{
	return true;
}

void duck::Draw()
{
	int screenX=0, screenY=0; 
		m_pParentMatrix->GetScreenPosFromCell(m_iXPos,m_iYPos,screenX,screenY);
		m_pBlockImg->BlitImage(screenX,screenY);
}

void duck::DrawOnScreen(const TRectanglei& rect)
{
	int XPos = (rect.GetWidth() - 2*BLOCK_WIDTH)/2 + rect.m_Left;
	int YPos = (rect.GetHeight() -2*BLOCK_HEIGHT)/2 + rect.m_Top;
	m_pBlockImg->BlitImage(XPos,YPos);
}

void duck::FillMatrix()
{

}

bool duck::IsValid()
{
	bool bValid = false;
	if (m_pParentMatrix->IsCellFree(m_iXPos-1,m_iYPos) )
	{
		bValid = true;
	}

	return bValid;
}
